<template>
  <div class="campus-binhai">
    <h2>滨海校区 - 学生查找</h2>
    <input v-model="studentId" placeholder="请输入学号" />
    <button @click="searchStudent">查找</button>
    <div v-if="student">
      <h3>学生信息</h3>
      <p>姓名: {{ student.name }}</p>
      <p>学号: {{ student.id }}</p>
      <p>专业: {{ student.major }}</p>
    </div>
  </div>
</template>

<script>
export default {
  name: 'CampusBinhai',
  data() {
    return {
      studentId: '',
      student: null
    }
  },
  methods: {
    searchStudent() {
      const students = [
        { id: '0001', name: '张三', major: '计算机科学' },
        { id: '0002', name: '李四', major: '软件工程' },
        { id: '0003', name: '王五', major: '网络工程' }
      ]
      this.student = students.find(s => s.id === this.studentId)
      if (!this.student) {
        alert('未找到该学号的学生信息')
      }
    }
  }
}
</script>

<style scoped>
.campus-binhai {
  text-align: center;
  margin-top: 50px;
}
input {
  margin-right: 10px;
}
</style>